<?php

namespace app\api\logic;

use app\admin\model\Article;
use app\admin\model\ProjectCate;
use app\admin\model\Projects;
use app\common\logic\BaseLogic;

class DemandLogic extends BaseLogic
{
    public static function cate()
    {
        return ProjectCate::field('id,title')
            ->where('status', '=', 1)
            ->order(['sort' => 'desc', 'id' => 'desc'])
            ->select()->toArray();
    }
    public static function detail($articleId)
    {
        $article = Projects::find($articleId);
        $hits = $article->hits;
        $article->hits = $hits + 1;
        $article->save();
        return $article->toArray();
    }

}